﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;


public class MainPanel : MonoBehaviour
{
    private Button btnStart;
    private Button btnShop;
    private Button btnRank;
    private Button btnSound;

    // Start is called before the first frame update
    void Start()
    {
        Init();
    }

    private void Init()
    {
        btnStart = transform.Find("btn_Start").GetComponent<Button>();
        btnStart.onClick.AddListener(OnStartButtonClick);
        btnShop = transform.Find("Btns/btn_Shop").GetComponent<Button>();
        btnShop.onClick.AddListener(OnShopButtonClick);
        btnRank = transform.Find("Btns/btn_Rank").GetComponent<Button>();
        btnRank.onClick.AddListener(OnRankButtonClick);
        btnSound = transform.Find("Btns/btn_Sound").GetComponent<Button>();
        btnSound.onClick.AddListener(OnSoundButtonClick);
    }

    private void OnStartButtonClick()
    {
        GameManager.Instance.IsGameStarted = true;
        EventCenter.Broadcast(EventType.ShowGamePanel);
        gameObject.SetActive(false);
    }

    private void OnShopButtonClick()
    {

    }

    private void OnRankButtonClick()
    {

    }

    private void OnSoundButtonClick()
    {

    }

}
